Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecte Rounding#round (backport #57845) #57893

Merged
merged 1 commit into from
Jun 9, 2020

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Jun 9, 2020

This deprecates Rounding#round and Rounding#nextRoundingValue in
favor of calling

Rounding.Prepared prepared = rounding.prepare(min, max);
...
prepared.round(val)

because it is always going to be faster to prepare once. There
are going to be some cases where we won't know what to prepare for
and in those cases you can call prepareForUnknown and stil be faster
than calling the deprecated method over and over and over again.

Ultimately, this is important because it doesn't look like there is an
easy way to cache Rounding.Prepared or any of its precursors like
LocalTimeOffset.Lookup. Instead, we can just build it at most once per
request.

Relates to #56124

This deprecates `Rounding#round` and `Rounding#nextRoundingValue` in
favor of calling
```
Rounding.Prepared prepared = rounding.prepare(min, max);
...
prepared.round(val)

``` because it is always going to be faster to prepare once. There
are going to be some cases where we won't know what to prepare *for*
and in those cases you can call `prepareForUnknown` and stil be faster
than calling the deprecated method over and over and over again.

Ultimately, this is important because it doesn't look like there is an
easy way to cache `Rounding.Prepared` or any of its precursors like
`LocalTimeOffset.Lookup`. Instead, we can just build it at most once per
request.

Relates to elastic#56124
@nik9000 nik9000 changed the title Deprecte Rounding#round (#57845) Deprecte Rounding#round (backport #57845) Jun 9, 2020
@nik9000 nik9000 merged commit 44a79d1 into elastic:7.x Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant